package com.brooks.demo;

import java.lang.ref.WeakReference;

/**
 * 弱引用
 * @Author hupengnan
 * @Date 2020/10/13 11:22
 * @Version 1.0
 */
public class M_WeakReference {
    public static void main(String[] args) {
        WeakReference<M> m = new WeakReference<>(new M());
        System.out.println(m.get());
        System.gc();
        System.out.println(m.get());

        ThreadLocal<M> tl = new ThreadLocal<>();
        tl.set(new M());
        tl.remove();
    }
}
